package com.qf.sl.youshare.model;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by IDEA
 * User : SL
 * on  2015/2/9.
 * 20:59
 */
public class Good {

    //TODO 成员变量

    private String goods_id;//  "130",
    private String cat_id;//  "1",
    private String goods_sn;//  "ECS000130",
    private String goods_name;//  "巧茜妮润莲保湿活肤露",
    private String goods_name_style;//  "+",
    private String click_count;//  "2",
    private String brand_id;//  null,
    private String provider_name;//  "",
    private String goods_number;//  "99",
    private String goods_weight;//  "0克",
    private String market_price;//  "￥85元",
    private String shop_price;//  "71.00",
    private String promote_price;//  "￥0元",
    private String promote_start_date;//  "0",
    private String promote_end_date;//  "0",
    private String warn_number;//  "1",
    private String keywords;//  "",
    private String goods_brief;//  "温和清洁每一个毛孔，保持肌肤水分舒缓，饱满光滑",
    private String goods_desc;//  "<p>&nbsp;<img src=\"http://i00.c.aliimg.com/img/ibank/2014/269/331/1752133962_1373137290.jpg\" alt=\"\" /></p>",
    private String goods_thumb;//  "images/201410/thumb_img/130_thumb_G_1413517366758.png",
    private String goods_img;//  "images/no_picture.gif",
    private String original_img;//  "",
    private String ComingSoon_img;//  "",
    private String long_img;//  "",
    private String is_real;//  "1",
    private String extension_code;//  "",
    private String is_on_sale;//  "1",
    private String is_alone_sale;//  "1",
    private String is_shipping;//  "0",
    private int integral;//  0,
    private String add_time;//  "2014-10-17",
    private String sort_order;//  "100",
    private String is_delete;//  "0",
    private String is_best;//  "0",
    private String is_new;//  "0",
    private String is_hot;//  "0",
    private String is_promote;//  "0",
    private String bonus_type_id;//  "0",
    private String last_update;//  "1413533764",
    private String goods_type;//  "0",
    private String seller_note;//  "",
    private String give_integral;//  "-1",
    private String rank_integral;//  "-1",
    private String suppliers_id;//  "0",
    private String is_check;//  null,
    private String measure_unit;//  "",
    private String goods_brand;//  null,
    private int bonus_money;//  0,
    private int comment_rank;//  5,
    private String rank_price;//  "71",
    private String shop_price_formated;//  "￥71元",
    private int promote_price_org;//  0,
    private int gmt_end_time;//  0

    //TODO 解析货物JSON数据

    public void parseJSON(JSONObject jsonObject){
        try {
            int code = jsonObject.getInt("code");
            if (code == 1){
                JSONObject msgObject = jsonObject.getJSONObject("msg");
                goods_id = msgObject.getString("goods_id");
                goods_name = msgObject.getString("goods_name");
                shop_price = msgObject.getString("shop_price");
                goods_thumb = msgObject.getString("goods_thumb");
                goods_img = msgObject.getString("goods_thumb");
                cat_id = msgObject.getString("cat_id");
                goods_sn = msgObject.getString("goods_sn");
                goods_number = msgObject.getString("goods_number");
                goods_weight = msgObject.getString("goods_weight");
                is_real = msgObject.getString("is_real");
                is_on_sale = msgObject.getString("is_on_sale");
                is_alone_sale = msgObject.getString("is_alone_sale");
                is_shipping = msgObject.getString("is_shipping");
                integral = msgObject.getInt("integral");
                is_delete = msgObject.getString("is_delete");
                is_best = msgObject.getString("is_best");
                is_new = msgObject.getString("is_new");
                is_hot = msgObject.getString("is_hot");
                is_promote = msgObject.getString("is_promote");
                goods_type = msgObject.getString("goods_type");
                give_integral = msgObject.getString("give_integral");
                rank_integral = msgObject.getString("rank_integral");
                suppliers_id = msgObject.getString("suppliers_id");
                comment_rank = msgObject.getInt("comment_rank");

                goods_brief = msgObject.optString("goods_brief");
                goods_name_style = msgObject.optString("goods_name_style");
                market_price = msgObject.optString("market_price");
                add_time = msgObject.optString("add_time");
                click_count = msgObject.optString("click_count");
                brand_id = msgObject.optString("click_count");
                provider_name = msgObject.optString("provider_name");
                promote_price = msgObject.optString("promote_price");
                promote_start_date = msgObject.optString("promote_start_date");
                promote_end_date = msgObject.optString("promote_end_date");
                warn_number = msgObject.optString("warn_number");
                keywords = msgObject.optString("keywords");
                goods_desc = msgObject.optString("goods_desc");
                original_img = msgObject.optString("original_img");
                ComingSoon_img = msgObject.optString("ComingSoon_img");
                long_img = msgObject.optString("long_img");
                extension_code = msgObject.optString("extension_code");
                sort_order = msgObject.optString("sort_order");
                bonus_type_id = msgObject.optString("bonus_type_id");
                last_update = msgObject.optString("last_update");
                seller_note = msgObject.optString("seller_note");
                is_check = msgObject.optString("is_check");
                measure_unit = msgObject.optString("measure_unit");
                goods_brand = msgObject.optString("goods_brand");
                bonus_money = msgObject.optInt("bonus_money");
                rank_price = msgObject.optString("rank_price");
                shop_price_formated = msgObject.optString("shop_price_formated");
                promote_price_org = msgObject.optInt("promote_price_org");
                gmt_end_time = msgObject.optInt("gmt_end_time");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    //TODO 通过GET方法获取参数

    public String getGoods_id() {
        return goods_id;
    }

    public String getCat_id() {
        return cat_id;
    }

    public String getGoods_sn() {
        return goods_sn;
    }

    public String getGoods_name() {
        return goods_name;
    }

    public String getGoods_name_style() {
        return goods_name_style;
    }

    public String getClick_count() {
        return click_count;
    }

    public String getBrand_id() {
        return brand_id;
    }

    public String getProvider_name() {
        return provider_name;
    }

    public String getGoods_number() {
        return goods_number;
    }

    public String getGoods_weight() {
        return goods_weight;
    }

    public String getMarket_price() {
        return market_price;
    }

    public String getShop_price() {
        return shop_price;
    }

    public String getPromote_price() {
        return promote_price;
    }

    public String getPromote_start_date() {
        return promote_start_date;
    }

    public String getPromote_end_date() {
        return promote_end_date;
    }

    public String getWarn_number() {
        return warn_number;
    }

    public String getKeywords() {
        return keywords;
    }

    public String getGoods_brief() {
        return goods_brief;
    }

    public String getGoods_desc() {
        return goods_desc;
    }

    public String getGoods_thumb() {
        return goods_thumb;
    }

    public String getGoods_img() {
        return goods_img;
    }

    public String getOriginal_img() {
        return original_img;
    }

    public String getComingSoon_img() {
        return ComingSoon_img;
    }

    public String getLong_img() {
        return long_img;
    }

    public String getIs_real() {
        return is_real;
    }

    public String getExtension_code() {
        return extension_code;
    }

    public String getIs_on_sale() {
        return is_on_sale;
    }

    public String getIs_alone_sale() {
        return is_alone_sale;
    }

    public String getIs_shipping() {
        return is_shipping;
    }

    public int getIntegral() {
        return integral;
    }

    public String getAdd_time() {
        return add_time;
    }

    public String getSort_order() {
        return sort_order;
    }

    public String getIs_delete() {
        return is_delete;
    }

    public String getIs_best() {
        return is_best;
    }

    public String getIs_new() {
        return is_new;
    }

    public String getIs_hot() {
        return is_hot;
    }

    public String getIs_promote() {
        return is_promote;
    }

    public String getBonus_type_id() {
        return bonus_type_id;
    }

    public String getLast_update() {
        return last_update;
    }

    public String getGoods_type() {
        return goods_type;
    }

    public String getSeller_note() {
        return seller_note;
    }

    public String getGive_integral() {
        return give_integral;
    }

    public String getRank_integral() {
        return rank_integral;
    }

    public String getSuppliers_id() {
        return suppliers_id;
    }

    public String getIs_check() {
        return is_check;
    }

    public String getMeasure_unit() {
        return measure_unit;
    }

    public String getGoods_brand() {
        return goods_brand;
    }

    public int getBonus_money() {
        return bonus_money;
    }

    public int getComment_rank() {
        return comment_rank;
    }

    public String getRank_price() {
        return rank_price;
    }

    public String getShop_price_formated() {
        return shop_price_formated;
    }

    public int getPromote_price_org() {
        return promote_price_org;
    }

    public int getGmt_end_time() {
        return gmt_end_time;
    }
}
